// Copyright 2020 morgine.com. All rights reserved.

package models

import (
	"time"
)

const (
	True Boolean = 1 + iota
	False
)

type Boolean int

func (b Boolean) IsTrue() bool {
	return b == True
}

func GetSqlBoolean(b bool) Boolean {
	if b {
		return True
	} else {
		return False
	}
}

type Image struct {
	ID        int
	File      string `gorm:"index"`
	Url       string `gorm:"-" desc:"服务地址"`
	LabelKey  string `gorm:"index"`
	CreatedAt *time.Time
}

type Label struct {
	ID          int
	Name        string
	Key         string `gorm:"unique_index"`
	Width       int
	Height      int
	AllowedEdit Boolean `desc:"允许后台操作图片(增删改), 1-允许 2-不允许"`
	SizeKB      int     `desc:"图片大小/KB"`
}
